﻿using System;
using System.Data.SqlClient;
using Jxym.DBUtility;
using System.Data;
using System.Collections;
using Jxym.wlkc2011.Module.Default.model;

namespace Jxym.wlkc2011.Module.CMS.SERVER
{
    public partial class sitesDel : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string returnVaoue = "", listIds = "";
            ArrayList list = new ArrayList();
            if (!IsPostBack)
            {
                if (Request.Params["ID"] != null)
                {
                    string idstr = Request.Params["ID"];
                    string[] ids = idstr.Split(',');
                    MsSqlDal<CMS.MODEL.Cms_Site> iUtm = new MsSqlDal<CMS.MODEL.Cms_Site>();
                    foreach (string id in ids)
                    {
                        try
                        {
                            int count = iUtm.Delete(id);

                            if (count > 0) { list.Add(id); }
                        }
                        catch (Exception)
                        {
                            returnVaoue += "<br/>( ID 为 <b>" + id + "</b> 的专题已被关联,不能删除。您可以尝试修改)";
                        }
                    }
                    foreach (string id in list)
                    {
                        listIds += id + ",";
                    }

                    listIds = listIds.TrimEnd(',');
                }
            }
            Response.Write("{'success':true,'count':" + list.Count + ",'ids':'" + listIds + "','msg':'" + returnVaoue + "'}");
        }
    }
}